<?php

class Core_Agent_Component_Account_View_Account_Login extends Core_Agent_Share_View_Form {

    protected function buildToolbar($toolbar) {
        $group = $toolbar->createGroup('back');
        $group->addLink($this->getUrl(null,'index','index','index'), $this->__('share.button.back'));
        $group = $toolbar->createGroup('save');
        $group->addButton($this->__('share.button.submit'))
        	  ->bindEvent('click', "Kdf.Ui.getForm('".$this->getForm()->getId()."').submit('".$this->getUrl(null, 'loginPost')."')");
        parent::buildToolBar($toolbar);
    }

    protected function buildForm($form) {
        $form->setAction($this->getUrl())
                ->setId('content_form')
                ->addHiddenField('id', 'content[id]');
        $form->addTextboxField($this->__('share.label.userName'), 'username', 'content[username]', TRUE)
                ->addValidateRule('required');
        $form->addPasswordField($this->__('share.label.password'), 'password', 'content[password]',TRUE)
                ->addMinLengthRule('6');
        $form->addValidateCodeField($this->__('share.label.validate_code'), 'validate_code', 'content[validate_code]');
        parent::buildForm($form);
    }

}